using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class JobSeekers_sendtofriend : System.Web.UI.Page
{
    string jobID = "";
    string jobName = "";
    string jobCompany = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            hiddenFieldPage.Value = 
            Convert.ToString(
            Request.QueryString.Get("page"));
            
            if(hiddenFieldPage.Value == "")
                hiddenFieldPage.Value = "myaccount.aspx";
            Page searchPage = this.PreviousPage;        
            if(searchPage != null)
            {
                switch (searchPage.Title)  
                {
                case "::Job Details":
                    DetailsView detailsView = (DetailsView)
                    searchPage.FindControl("DetailsView1");
                    txtSubject.Text = 
                    detailsView.Rows[3].Cells[1].Text;
                    
                    jobName = detailsView.Rows[3].Cells[1].Text;
                    jobCompany = detailsView.Rows[0].Cells[1].Text;
                    jobID = detailsView.Rows[3].Cells[1].Text;
                    hiddenFieldFrom.Value = "Job";
                    break;
                }
            }
            txtYourFullName.Text = 
            ((Session["jsfullname"] != null) ? 
            Session["jsfullname"].ToString() : "");
        }
        catch(Exception ex)
        {
            literalError.Text = ex.Message;
        }
    }
    protected void btnSend_Click(object sender, EventArgs e)
    {
         try
            {
            switch(hiddenFieldFrom.Value)
            {
                case "Job":
                    RecruitVietnam recruitVietnam 
                    = new RecruitVietnam();
                    recruitVietnam.SendJobToFriend(
                    txtEmail.Text, txtFullName.Text, 
                    txtYourFullName.Text,
                    txtSubject.Text, txtBody.Text, 
                    jobID, jobName, jobCompany);
                  
                break;
            }
            Response.Redirect(hiddenFieldPage.Value);
        }
        catch (Exception ex)
        {
            literalError.Text = ex.Message;
        }
    }
    protected void btnBack_Click(object sender, EventArgs e)
    {
        Response.Redirect(hiddenFieldPage.Value); 
    }
}
